<meta charset="UTF-8">
<script src="Fish.js"></script>

<script>
	function Fish(x,y,w,h,bgimg,count,time){
    var e = document.createElement("div");
    var s = e.style;
    s.position = "absolute";
    s.left = x;
    s.top = y;
    s.width = w;
    s.height = h/count;
    s.background = "url("+bgimg+")";
    document.body.appendChild(e);
    var bgy = 0;

    var timer = setInterval(function(){
        bgy = bgy - parseInt(s.height);
        if(bgy==-parseInt(s.height)*count/2) bgy = 0;
        s.background = "url("+bgimg+") 0px "+bgy+"px";
    },time);
}
	
    function Cat(){

    }
   window.onload = function(){
      var f1 = new Fish(10,10,178,1870,"fish10.png",10,100);
      var f2 = new Fish(200,10,166,2196,"fish9.png",12,100);
      var f3 = new Fish(400,20,55,296,"fish1.png",8,100);

      var c = new Cat();

      console.log(f1 instanceof Fish);
      console.log(f1 instanceof Cat);
      console.log(f1 instanceof Object);
   };
</script>